Structuring inventory file

Hi,

I have a hosts.yml file which contains the host IP for each environment, and it appears the file is not parsing the subsections correctly.

Here's how my hosts.yml look like: https://imgur.com/2hDxxsy

My Playbook looks like this: https://imgur.com/SJExUw1

I run my playbook through Postman by calling an Ansible API: https://imgur.com/rdUERFK

Issue is: irrespective of what I pass in 'env' field, it always falls back to stg machines. Even if I pass env='prd', it tries to carry out action against stg machines which is not what I wanted.

I thought maybe the host info is cached somewhere. I checked ansible.cfg and everything with caching was commented out.
How do I compose my hosts.yml file so that it refers to 'env' and chooses the appropriate machines to run against?

The extra_vars gets composed like this:

env='stg' product='PRODUCT' dbuplift_servers='sql2' ansible_user='SOMEUSER' ansible_password='SOMESTRONGPASSWORD' CustomerName='CUSTOMERNAME' customer_container_name='BLOBCONTAINER' sql_named_instance='SQLSTUFF' migration_id='MIG' infra_operation_id='ANS-6ffa8aae-217b-4e24-85a9-633209e6558f' request_id='fd65d843-e9cc-4fb6-89bf-b5d96efe7ffd'